<template>
  <div id="app">
    <NavBar :title=nav_title class="nav"></NavBar>
    <div class="body">
      <router-view /> 
    </div>
    <TabBar :tabBars="tabBars"></TabBar>
  </div>
</template>

<script>
// 导入TabBarItem.vue
import TabBar from "@/components/TabBar.vue";
import NavBar from "@/components/NavBar.vue";
export default {
  name: "App",
  data: function() {
    console.log(this.$store);
    return {
      tabBars: [
        {className: "icon-changyonglogo40", title: "外卖", path: { name: "Home" }, },
        { className: "icon-search", title: "搜索", path: { name: "Search" } },
        { className: "icon-dingdan", title: "订单", path: { name: "Dingdan" } },
        { className: "icon-wode2", title: "我的", path: { name: "My" },
        },
      ],
     
     
    };
  },
  // 计算属性里边的数据源发生变化  响应式的发生数据变化
  computed:{
    nav_title: function(){
      return this.$store.state.nav.title;
    }
  },
  components: {
    TabBar,
    NavBar
  },
  methods: {},
};
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
#nav {
  width: 100%;
  background-color: gainsboro;
  color: white;
  text-align: center;
  position: fixed;
  left: 0;
  top: 0;
  line-height: 44px; /*no */
  font-size: 40px;
  z-index: 10;
}
.body {
  padding: 44px 0 48px; /*no*/
}

</style>
